package main;

import java.awt.*;
import javax.swing.*;
import controller.RunController;
import controller.*;
import logic.*;
import view.*;

public class Vk {
	// the general frame
	private JFrame screen;
	// the views which are displayed
	private AbstractView fieldView;
	private AbstractView pieView;
	private AbstractView lineView;
	private AbstractView histoView;
	private AbstractView pictureCounterView;
	// the current simulator
	private Simulator simulator;
	// the controllers to start/stop the simulation and to set the field 
	private AbstractController initController;
	private AbstractController runController;
	private AbstractController topController;
	
	/**
	 * makes a new frame with a simulator, views and controller
	 * and makes it visible.
	 */
	public Vk() {
		simulator=new Simulator(50,50);
		fieldView=new FieldView(simulator);
		runController=new RunController(simulator);
		initController= new InitController(simulator);
		topController = new TopController(simulator);
		pieView = new PieView(simulator);
		histoView =  new HistogramView(simulator);
		lineView = new LineView(simulator);
		pictureCounterView =  new PictureCounterView(simulator);
		JPanel seeView = new JPanel();
		seeView.setLayout(new GridLayout(2,2));
		seeView.add(fieldView);
		seeView.add(pieView);
		seeView.add(lineView);
		seeView.add(histoView);
		
		screen=new JFrame("Vossen en Konijnen");
		screen.setJMenuBar(((TopController)topController).getMenu());
		screen.setLocation(100, 100);
		screen.setSize(800, 700);
		screen.setResizable(false);
		screen.setLayout(new BorderLayout());
		screen.getContentPane().add(runController, BorderLayout.WEST);
		screen.getContentPane().add(initController, BorderLayout.EAST);
        screen.getContentPane().add(((FieldView) fieldView).getStepLabel(), BorderLayout.NORTH);
		//screen.getContentPane().add(((FieldView) fieldView).getPopulationLabel(), BorderLayout.SOUTH);
        screen.getContentPane().add(pictureCounterView, BorderLayout.SOUTH);
        screen.getContentPane().add(seeView, BorderLayout.CENTER);
        screen.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		screen.setVisible(true);
	}
}
